﻿@using System.Web.Mvc.Html
@using GameSchool.HtmlHelpers
@model GameSchool.ViewModels.Project.ListViewModel
@{
    ViewBag.Title = "Verkefnalisti";
}
<h2>Verkefnalisti fyrir @Model.currentCourse.Code, @Model.currentCourse.Name, @Model.currentCourse.Semester.Year-@Model.currentCourse.Semester.SemesterOfYear</h2> 
<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
@if (Roles.IsUserInRole("Kennari"))
{
    <p>
        <a href="@Url.Action("Create", new { id = Model.currentCourse.CourseID })" class="btn">Skrá nýtt
            verkefni</a>
    </p>
}
<table class="table table-striped">
    <tr>
        <th>
            Heiti
        </th>
        <th>
            Skilað
        </th>
        <th>
            Eftir að skila
        </th>
        <th>
            Meðaleinkunn
        </th>
        <th>
            Hæsta einkunn
        </th>
        <th>
        </th>
    </tr>
    @foreach (var item in Model.projectsTeachers)
    {
        <tr>
            <td>
                @Html.ActionLink(item.Name, "Result", new { id = item.ProjectID })
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.Returned)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.NotReturned)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.AverageGrade)
            </td>
            <td>
                @Html.DisplayFor(modelITem => item.HighestGrade)
            </td>
            <td>
                @Html.ActionLink("Breyta", "Edit", new { id = item.ProjectID }, new { @class = "btn btn-mini" })
                @Html.ActionLink("Niðurstöður", "Result", new { id = item.ProjectID }, new { @class = "btn btn-mini"})
            </td>
        </tr>
    }
</table>
